home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / archival / mirror-2.1 / mirror.nightly < prev    next >
Encoding:
Text File  |  1993-06-18  |  1.2 KB  |  58 lines

  1. #!/bin/sh
  2. # Manage a nightly mirror run.
  3. # Most of the dirty work is done via mm.  This
  4. # really just handles the logs and mails them out.
  5.  
  6. # Where mirror and mm are to be found
  7. home=/src.doc.ic.ac.uk/public/ic.doc/mirror
  8.  
  9. # Who and how to mail stuff back
  10. mailto=lmjm
  11. mail=mail
  12. mailargs="-s 'nightly mirror log'"
  13.  
  14. # Arguemnt to pass to sort to get it to show the biggest files
  15. # in a directory listing.
  16. #BSD usually +3n, System 5 usually +4n.
  17. biggest=+3n
  18.  
  19. # You shouldn't have to change anything below here.
  20.  
  21. # Log output here.
  22. log=mirror.nightly.out
  23.  
  24. cd $home
  25.  
  26. if [ -r $log ]; then
  27.     # Keep one days backups of the old logs
  28.     mv -f $log $log.old
  29. fi
  30.  
  31. # Run mirror master
  32. #  It will output all the pagage log info' into files in
  33. # the logs/ directory.
  34. rm -f $log
  35. if test ! -d logs; then mkdir logs; fi
  36. ./mm -debug mmin >$log 2>&1 < /dev/null
  37.  
  38. # Send me the "interesting" bits of the logs
  39. # The old, new and big stuff
  40. logs_ls=/tmp/logs-ls
  41. ls -ltr logs > $logs_ls
  42. (
  43.     echo Unlinks needed on:
  44.     grep -l "^NEED" logs/*
  45.     echo Old:
  46.     head $logs_ls
  47.     echo
  48.     echo Recent:
  49.     tail $logs_ls
  50.     echo
  51.     echo Bigest:
  52.     sort $biggest < $logs_ls | tail
  53.     echo
  54.     echo Those logs in full:
  55.     cat -s logs/*
  56. ) | eval $mail $mailargs $mailto
  57. rm -f $logs_ls
  58.